"""
file: test_run.py
Author: 城下秋草
Date: 2024/12/27
Desc: 测试运行控制
"""
import sys
from time import sleep

import pytest


@pytest.mark.skipif(sys.platform != "win32",reason="该用例不在windows系统上执行")
@pytest.mark.run(order=2)
def test_run1():
    assert True

@pytest.mark.xfail(sys.version_info > (3,10),reason="预期失败",
                   strict=True,run=False)
def test_run2():
    assert False

@pytest.mark.parametrize("name",[
    "秋草",
    pytest.param("测试",marks=pytest.mark.skip),
    pytest.param("demo",marks=pytest.mark.xfail(reason="长度超长"))])
def test_run3(name):
    assert len(name) < 3

class TestRun:
    @pytest.mark.run(order=200)
    @pytest.mark.dependency
    # @pytest.mark.flaky(reruns=3,reruns_delay=2)
    def test_run4(self):
        sleep(1)
        assert True

    @pytest.mark.run(order=1)
    @pytest.mark.dependency(name="depend")
    @pytest.mark.repeat(5)
    def test_run5(self):
        sleep(1)
        assert True

    @pytest.mark.dependency(depends=["TestRun::test_run4","depend"])
    @pytest.mark.run(order=300)
    def test_run6(self):
        sleep(1)
        assert True